<?php

/*
 * CLASE ENTIDAD SOLICITANTE 
 * Autor: Luis Rojas
 * Version: 1.0
 * Fecha Creacion: 26/08/2013
 * Fecha Modificación: 26/08/2013
 */
require_once '../Control/CsCtrlData.php';
require_once '../Data/CsConexion.php';
class CsSolicitante extends CsConexion {
    var $tabla1;
    var $tabla2;
    var $atributo;
    var $dato;
    var $ncol;
    var $nllave;
            
    function  CsCargo(){
        $this->tabla1 = "solicitante";
        $this->tabla2 = "persona";
        $this->atributo[0]="percod";
        $this->atributo[1]="clicod";
        $this->ncol=2;
        $this->nllave=1;
    }
    
    function GuardarDato($cn){
        $objcontrol = new CsCtrlData();
        $sql = $objcontrol->Insert($this->tabla, $this->dato, $this->ncol);
        return $this->Transaccionx($sql,$cn);
    }
    
    function ActualizarDato($cn){
        $objcontrol = new CsCtrlData();
        $sql = $objcontrol->Update($this->tabla, $this->dato, $this->atributo, $this->ncol, $this->nllave);
        return $this->Transaccionx($sql, $cn);
    }
    
    function EliminarDato($cn){
        $objcontrol = new CsCtrlData();
        $sql = $objcontrol->Delete($this->tabla, $this->dato, $this->atributo, $this->nllave);
        return $this->Transaccionx($sql, $cn);
    }
    
    function TraerDatos(){
        $colum = $this->atributo[0];
        $sql = "select * from $this->tabla2 per inner join $this->tabla1 sol on per.$colum = sol.$colum";
        return $this->Transaccion($sql);
    }
    
    function Identidad(){
        $valor = $this->dato[0];
        $sql = "select cargo.carnom, cliente.cliras from solicitante inner join persona on solicitante.percod = persona.percod inner join cliente on solicitante.clicod = cliente.clicod inner join cargo on persona.carcod = cargo.carcod where solicitante.percod = $valor";
        return $this->Transaccion($sql);
    }
    
    function SolicitantexCliente(){
        $valor = $this->dato;
        $sql = "select solicitante.percod, persona.pernom,cargo.carnom from solicitante inner join persona on solicitante.percod = persona.percod inner join cargo on persona.carcod = cargo.carcod where persona.pernom like '$valor[1]' and solicitante.clicod = $valor[0]";
        return $this->Transaccion($sql);
    }
}

?>
